package com.imooc.ioc.demo1.test1;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringDemo2 {
    @Test
    public void demo() {
        //创建spring的工厂
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationcontext.xml");
        //UserService userService = (UserService) applicationContext.getBean("userService");
        Food food = (Food) applicationContext.getBean("food");
        // userService.sayHello();
        System.out.println(food);
    }
}
